package com.huawei.appmarket.service.externalapi.view;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnDismissListener;
import android.os.Bundle;
import com.huawei.appgallery.foundation.application.pkgmanage.model.update.ApkUpgradeInfo;
import com.huawei.appmarket.service.thirdappdl.ThirdAppDownloadActivity;
import com.huawei.appmarket.service.thirdappdl.ThirdAppDownloadActivityProtocol;
import java.util.LinkedHashMap;
import o.dgh;
import o.Logger;
import o.dug;
import o.ewm.h;
import o.ewm.n;

public class ShowUpdateActivity extends ThirdAppDownloadActivity {
    private static String ͺ = "ShowUpdateActivity";
    private int ʻॱ;
    private int ˏॱ;
    private AlertDialog ॱˎ;
    private String ॱᐝ;
    private String ᐝॱ;

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
    }

    public void ᐝ() {
        super.ᐝ();
        ˈ();
    }

    public boolean ʼ() {
        return false;
    }

    private void ˈ() {
        ThirdAppDownloadActivityProtocol thirdAppDownloadActivityProtocol = (ThirdAppDownloadActivityProtocol) ʾ();
        if (thirdAppDownloadActivityProtocol == null) {
            Logger.e(ͺ, "arguments is null!!!");
            finish();
            return;
        }
        this.ʻॱ = thirdAppDownloadActivityProtocol.ˊ().ᐝ();
        this.ˏॱ = ˊᐝ();
        this.ᐝॱ = thirdAppDownloadActivityProtocol.ˊ().ˎ();
        this.ॱᐝ = thirdAppDownloadActivityProtocol.ˊ().ˋ();
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("targetVersionCode = ").append(this.ॱˊ).append(" , currentVersionCode = ").append(this.ʻॱ).append(" , cacheVersionCode = ").append(this.ˏॱ);
        Logger.ˎ(ͺ, stringBuilder.toString());
        String string = getString(n.ᐝॱ);
        super.ˊ(getString(n.ՙˊ, new Object[]{string}));
        super.ˎ(getPackageName());
    }

    private int ˊᐝ() {
        ApkUpgradeInfo ॱ = dug.ॱ(getPackageName());
        if (ॱ == null) {
            return 0;
        }
        return ॱ.ʿ();
    }

    public void ॱˊ() {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("action", "update");
        dgh.ˋ("330002", linkedHashMap);
        super.ॱˊ();
    }

    public void ˊॱ() {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("action", "cancel");
        dgh.ˋ("330002", linkedHashMap);
        super.ˊॱ();
    }

    public void ͺ() {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("v", String.valueOf(this.ॱˊ));
        linkedHashMap.put("clientVersion", String.valueOf(this.ʻॱ));
        linkedHashMap.put("url", this.ᐝॱ);
        linkedHashMap.put("type", this.ॱᐝ);
        dgh.ˋ("330001", linkedHashMap);
        super.ͺ();
    }

    public boolean ॱˎ() {
        if (this.ˏॱ != 0 && this.ॱˊ <= this.ˏॱ) {
            return true;
        }
        ˊˊ();
        return false;
    }

    private void ˊˊ() {
        Builder builder = new Builder(this);
        builder.setMessage(n.ͺˌ);
        builder.setPositiveButton(n.ˋՙ, new OnClickListener(this) {
            final /* synthetic */ ShowUpdateActivity ˏ;

            {
                this.ˏ = r1;
            }

            public void onClick(DialogInterface dialogInterface, int i) {
                this.ˏ.ॱˎ.dismiss();
            }
        });
        builder.setOnDismissListener(new OnDismissListener(this) {
            final /* synthetic */ ShowUpdateActivity ˋ;

            {
                this.ˋ = r1;
            }

            public void onDismiss(DialogInterface dialogInterface) {
                this.ˋ.finish();
            }
        });
        this.ॱˎ = builder.create();
        this.ॱˎ.show();
    }

    public int ॱˋ() {
        return n.ﹶ;
    }

    public int ᐝॱ() {
        return h.ʼʽ;
    }
}
